﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using DTO;

namespace BLL
{
    public class JobBLL
    {
        static int id = 0;
        HospitalDataContext DB = new HospitalDataContext();
        public string Insert(JobDTO job)
        {
            try
            {
                Job j = new Job();
                j.JobID=(id++).ToString();
                j.StaffID = job.StaffId;
                j.PositionID = job.Position;
                j.CurrentSalary = job.CurrentSalary;
                j.SalaryScale = job.SalaryScale;
                j.HoursWeek = job.Hours;
                j.Paid = job.Paid;
                j.Contract = job.Contract;
                j.StartDate = job.StartDate;

                DB.Jobs.InsertOnSubmit(j);
                DB.SubmitChanges();
                return "success";
            }
            catch (Exception ex)
            {
                return ex.Message;
            }


        }
    }
}
